﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace ServicesDirectory.UserControl
{
    public partial class OrganisationDetail1 : System.Web.UI.UserControl
    {
        public string OrgName;
        public string ShortDescription;
        public string ContactId ;
        public string AddressLine1 ;
        public string AddressLine2 ;
        public string AddressLine3 ;
        public bool OrgPreferred ;
        public bool ExpressionOfBusiness ;
        public Guid BusinessId ;
        public string OrgFullDescription ;
        public string PhoneNumber ;
        public string Fax ;
        public string Email ;
        public string WebAddress ;
        public string CharityNumber ;
        public string CompanyNumber ;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void GetData()
        {
            OrgName = txtOrganisationName.Text;
            ShortDescription = txtDescription.Text;
            ContactId = lblLeadContact.Text;
            AddressLine1 = txtAddress1.Text;
            AddressLine2 = txtAddress2.Text;
            AddressLine3 = txtAddress3.Text;
            OrgPreferred = chkPreferred.Checked;
            ExpressionOfBusiness = chkExpression.Checked;
            if(!String.IsNullOrEmpty(lbtTypeOfBusiness.CommandArgument))
            BusinessId = new Guid(lbtTypeOfBusiness.CommandArgument);
            OrgFullDescription = txtFullDescription.Text;
            PhoneNumber = txtPhoneNumber.Text;
            Fax = txtFax.Text;
            Email = txtEmail.Text;
            WebAddress = txtWebAddress.Text;
            CharityNumber = txtCharity.Text;
            CompanyNumber = txtCompany.Text;
        }

        public void LoadData()
        {
            txtOrganisationName.Text = OrgName;
            txtDescription.Text = ShortDescription;
            lblLeadContact.Text = ContactId;
            txtAddress1.Text =AddressLine1;
            txtAddress2.Text =AddressLine2;
            txtAddress3.Text = AddressLine3;
            chkPreferred.Checked = OrgPreferred;
            chkExpression.Checked = ExpressionOfBusiness;
            txtFullDescription.Text = OrgFullDescription;
            txtPhoneNumber.Text = PhoneNumber;
            txtFax.Text = Fax;
            txtEmail.Text = Email;
            txtWebAddress.Text = WebAddress;
            txtCharity.Text = CharityNumber;
            txtCompany.Text = CompanyNumber;
        }
    }
}